<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        .box{
            /* padding:50px; */
            position: relative;
        }
        .top{
            width: 200px;
            height: 100px;
            background: red;
            border-radius: 100px 100px 0 0;
            animation: up 0.5s infinite alternate;
            transform-origin:center bottom ;
            /* transition: all 2s;l */
        }
        .bottom{
            width: 200px;
            height: 100px;
            background: red;
            border-radius: 0 0 100px 100px;
            animation: down 0.5s infinite alternate;
            transform-origin:center top;
            /* transition: all 2s; */
        }
        @keyframes up{
            0%{transform: rotate(10deg);}
            100%{transform: rotate(-45deg);}
        }
        @keyframes down{
            0%{transform: rotate(-10deg);}
            100%{transform: rotate(45deg);}
        }
        .dot{
            width: 20px;
            height: 20px;
            /* background: red; */
            position: absolute;
            top: 0;
            bottom: 0;
            margin: auto;
            left: 380px;
            border-radius: 50%;
            animation: move 1s infinite;
            z-index: -1;
        }
        .box:before{
            content: "";
            display: inline-block;
            width: 100px;
            height: 200px;
            border-radius: 100px 0 0 100px;
            background: red;
            position: absolute;
            top: 0;
            left: 0;
        }
        @keyframes move{
            0%{left:380px}
            100%{left:150px}
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="top"></div>
        <div class="bottom"></div>
        <div class="dot"></div>
    </div>
    <script>
        var dot = document.querySelector(".dot");
       setInterval(function(){
        var a = Math.floor(Math.random()*255)
        var b = Math.floor(Math.random()*255)
        var c = Math.floor(Math.random()*255)
        dot.style.background = "rgb("+a+","+b+","+c+")";
       },1000)     
            
    </script>
</body>
</html>